﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BLL.Services.Televisors.Listing
{
    public class TelevisorsListing
    {
        public TelevisorsListing()
        {
            Televisors = new List<Televisor>();

            Filter = new TelevisorsFilter();
        }

        public int Page { get; set; }

        public int Size { get; set; }

        public int TotalCount { get; set; }

        public string Column { get; set; }

        public int Direction { get; set; }

        public TelevisorsFilter Filter { get; set; }

        public List<Televisor> Televisors { get; set; }

        public class Televisor
        {
            [UIHint("hidden")]
            public int TelevisorId { get; set; }

            [Display(Name = "Name")]
            public string Name { get; set; }

            [Display(Name = "Magazine")]
            public string Magazine { get; set; }

            [Display(Name = "Type")]
            public int TypeInt { get; set; }

            [Display(Name = "Diagonal")]
            public decimal Diagonal { get; set; }

            [Display(Name = "TreeD")]
            public bool TreeD { get; set; }

            public DateTime Date { get; set; }

            [Display(Name = "ReleaseDate")]
            public string ReleaseDate
            {
                get
                {
                    return Date.ToString(CultureInfo.InvariantCulture);
                }
            }

            public string Type
            {
               
                get
                {
                    switch (TypeInt)
                    {
                        case 0:
                            return TelevisorsType.None.ToString();
                        case 1:
                            return TelevisorsType.Lcd.ToString();
                        case 2:
                            return TelevisorsType.Crt.ToString();
                    }
                    return string.Empty;
                }
            }
        }
    }
}
